Repository navigation
Conversation
…kpoint slime saves checkpoint rollout_id (0-based), so with --save-interval N the iterations are N-1, 2N-1, ...; Megatron's retention deletes every previous checkpoint that is not a multiple of --save-retain-interval, so forwarding the option keeps only the latest checkpoint. Fail at argument validation instead of silently deleting checkpoints. Fixes THUDM#2532
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #2532.
slime forwards Megatron's
--save-retain-intervalunchanged, but it saves checkpointrollout_id(0-based): with--save-interval Nthe saved iterations areN-1, 2N-1, .... Megatron'siter_finalize_fndeletes the previous checkpoint wheneverprev_iteration % save_retain_interval != 0, and none of slime's iterations is ever a multiple of the retain interval. So each save deletes the one before it, and only the latest checkpoint survives: the opposite of what the option is for. The issue has the full code path and a 2-GPU reproduction, including aniter_0000003left half-deleted when the job exits.Runs that don't set
--save-retain-intervalare not affected, because Megatron then deletes nothing.Change
slime_validate_argsnow raises aValueErrorwhen--save-retain-intervalis set. The message explains the numbering mismatch and links the issue. This is the first option proposed in #2532. It turns silent checkpoint loss into an error at startup and leaves the checkpoint numbering alone, whichactor.py,slime/data/checkpoint.py, the queue data source and--ckpt-step/--ref-ckpt-stepdepend on.The check uses
getattr(args, "save_retain_interval", None), so a Megatron parser that has no such option is unaffected.Doing retention in slime by step count (the issue's second option) would need careful handling of async saves and of shutdown. I left that for a follow-up if maintainers want it. The open "keep the last N checkpoints" PRs (#1798, #1914, #2290) don't touch
--save-retain-interval, so they don't overlap with this change.Tests
test_slime_validate_args_rejects_save_retain_interval: fails onmain(DID NOT RAISE ValueError) and passes with the fix.test_slime_validate_args_accepts_unset_save_retain_interval: passes before and after.pytest tests/test_megatron_argument_validation.py(CPU venv: torch, numpy, ray, pyyaml): 67 passed, 8 failed after the change vs. 65 passed, 8 failed onmain. The same 8 tests fail on both, from optional dependencies missing in my environment, so the change introduces no new failures.pre-commit run --fileson both changed files: ruff, autoflake, isort and black all pass.I didn't run a GPU training job. The change only adds an argument check.
Duplicate check
I searched PRs for
save-retain-interval,save_retain_intervaland2532and found none.AI assistance: this change was prepared with the help of an AI coding assistant. I reviewed the diff and the tests.